<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('AdminTag/index')}">问答管理</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminTag/index')}">
        名称:
        <input type="text" class="form-control" name="keyword" style="width: 200px;"
               value="{$keyword|default=''}" placeholder="请输入关键字">
        状态:
        <select name="status" id="input-cycle_type" class="form-control">
            <option value="0"  <if condition="$status eq 0"> selected </if>>不限</option>
            <option value="1" <if condition="$status eq 1"> selected </if> >已回复</option>
            <option value="2"  <if condition="$status eq 2"> selected </if>>未回复</option>
        </select>

        <button class="btn btn-primary">搜索</button>
    </form>
    <form method="post" class="js-ajax-form margin-top-20">
        <div class="table-actions">
            <!--<button type="submit" class="btn btn-primary btn-sm js-ajax-submit">{:lang('SORT')}</button>-->
        </div>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th>序号</th>
                <th>提问人</th>
                <th>回复人</th>
                <th>问题</th>
                <th>回答</th>
                <th>时间</th>
                <th>状态</th>
                <th width="160">操作</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="list" item="vo">
                <tr>
                    <td title="ID:{$vo.id}">{$vo.id}</td>
                    <td>{$vo.mobile}</td>
                    <td>{$vo.admin_name}</td>
                    <td>{$vo.description}</td>
                    <td>{$vo.answer}</td>
                    <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>

                    <td>
                        <switch name="vo.status">
                            <case value="0">
                                <span class="label label-danger">异常</span>
                            </case>
                            <case value="1">
                                <span class="label label-success">正常</span>
                            </case>
                            <case value="2">
                                <span class="label label-warning">禁用</span>
                            </case>
                        </switch>
                    </td>

                    <td>
                        <eq name="vo.status" value="1">
                            <a class="btn btn-xs btn-warning js-ajax-dialog-btn"
                               href="{:url('AdminQuestions/upStatus',['id'=>$vo['id'],'status'=>2])}">禁用</a>
                            <else/>
                            <a class="btn btn-xs btn-success js-ajax-dialog-btn"
                               href="{:url('AdminQuestions/upStatus',['id'=>$vo['id'] ,'status'=>1])}">启用</a>
                        </eq>
                        <a class="btn btn-xs btn-danger js-ajax-delete"
                           href="{:url('AdminQuestions/delete',['id'=>$vo['id']])}">删除</a>

                    </td>

                    <td>
                        <a class="btn btn-xs btn-primary" href="javascript:;"
                           onclick="openPortalArticleEditDialog(this)"
                           data-href="{:url('AdminQuestions/edit',array('id'=>$vo['id']))}">回复</a>

                    </td>

                </tr>
            </foreach>
            </tbody>

        </table>
        <div class="table-actions">
            <!--<button type="submit" class="btn btn-primary btn-sm js-ajax-submit">{:lang('SORT')}</button>-->
        </div>
    </form>
    <ul class="pagination">{$page|default=''}</ul>
</div>
<script src="__STATIC__/js/admin.js?v={$_static_version}"></script>

<script>
    function openPortalArticleEditDialog(obj) {
        var $obj = $(obj);
        var href = $obj.data('href');
        parent.openIframeLayer(href, '回复', {
            area: GV.IS_MOBILE ? ['100%', '100%'] : ['50%', '50%'],
            offset: GV.IS_MOBILE ? ['0px', '0px'] : 'auto',
            // btn: ['确定', '取消'],
            yes: function (index, layero) {
                console.log(layero);
                var iframeWin = parent.window[layero.find('iframe')[0]['name']];
                //iframeWin.confirm();
                parent.layer.close(index); //如果设定了yes回调，需进行手工关闭
            },
            end: function () {
            }
        });
    }

</script>
</body>
</html>
